package com.design.patterns.list.responsibilitychain;

/**
 * @author Wangzhiwen
 */
public abstract class Handler {

    /**
     * 处理类名称
     */
    private final String name;

    /**
     * 下一个执行者
     */
    protected Handler next;

    public Handler() {
        this.name = this.getClass().getSimpleName();
    }

    public String getName() {
        return name;
    }

    public void setNext(Handler next) {
        this.next = next;
    }

    /**
     * 处理请求
     *
     * @param request 请求体
     */
    protected abstract void processRequest(Request request);
}
